def calc_sum(*nums):
    n = 0;
    for num in nums:
        n += num
    return n
print(calc_sum(10,20,30))

def sum_late(*nums):
    def inner_sum(*nums):
        n = 0;
        for num in nums:
            n += num
        return n

    return inner_sum
fun = sum_late(10, 20, 30)
print(fun(1,2,3))

def fun_count():
    fs = []
    for i in range(1, 4):
        def f():
            return i * i

        fs.append(f)

    return fs
f1, f2, f3 = fun_count();
print(f1())
print(f2())
print(f3())

def fun_count_up():
    fs = []

    def f(j):
        def g():
            return j * j
        return g
    for i in range(1, 4):
        fs.append(f(i))

    return fs
f4, f5, f6 = fun_count_up();
print(f4())
print(f5())
print(f6())